<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
        input , li{
            width: 200px;
            height: 30px;
            margin-bottom: 10px;
            font-size: 14px;
            font-family: 楷体;
        }
        ul{
            list-style: none;
        }
    </style>
</head>
<body>
    <div id="app">
        <input type="text" v-model="message" @keyup.enter="addMessage">
        <br>
        <ul v-for="liValue in arr">
            <li>{{liValue}}</li>
        </ul>
        <label v-text="arr.length+' is number '"></label>
        <button  v-on:click="clearArr">清空</button>
    </div>

    <script>
        var app = new Vue({
            el:"#app",
            data:{
                arr:[],
            },
            methods:{
                addMessage:function () {
                    this.arr.push(this.message);
                },
                clearArr:function () {
                    this.arr=[];
                }
            }
        })
    </script>
</body>
</html>